#include<iostream>
#include<string> 
#include<vector>
#include<algorithm>
using namespace std;
struct node
{
	string cn;
	double sc1;
	double sc2;
	
	bool operator>(const node& n)
	{
		return sc2>n.sc2;	
	}
	bool operator<(const node& n)
	{
		return sc2<n.sc2;	
	}
	bool operator==(const node& n)
	{
		return sc2==n.sc2;	
	} 
};

istream& operator>>(istream& in,node& n)
{
	in>>n.cn>>n.sc1>>n.sc2;
	return in;
}

ostream& operator>>(ostream& out,node& n)
{
	out<<n.cn<<" "<<n.sc1<<" "<<n.sc2<<endl;
	return out;
}



int main()
{
	int n=0;
	cin>>n;
	vector<node> scs(n);
	for(int i=0;i<n;i++)
	{
		cin>>n;
	}
	sort(scs.begin(),scs.end());
	for(int i=0;i<n;i++)
	{
		cout<<n;
	}
	return 0;
}
